/*******************************************************************************
 * Copyright (c) 2020 Red Hat Inc. and others.
 * This program and the accompanying materials are made
 * available under the terms of the Eclipse Public License 2.0
 * which is available at https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 *******************************************************************************/
package org.eclipse.lemminx.extensions.maven.participants.completion;

import java.util.Objects;

public class Phase {

	public final String id;
	public final String description;
	
	private Phase(String id, String description) {
		this.id = id;
		this.description = description;
	}

	@Override
	public boolean equals(Object obj) {
		if (obj.getClass() != this.getClass()) {
			return false;
		}
		return Objects.equals(((Phase)obj).id, this.id);
	}
	
	@Override
	public int hashCode() {
		return Objects.hashCode(id);
	}
	
	public static final Phase[] ALL_STANDARD_PHASES = {
		new Phase("pre-clean", "execute processes needed prior to the actual project cleaning"),
		new Phase("clean", "remove all files generated by the previous build"),
		new Phase("post-clean", "execute processes needed to finalize the project cleaning"),
		new Phase("validate", "validate the project is correct and all necessary information is available."),
		new Phase("initialize", "initialize build state, e.g. set properties or create directories."),
		new Phase("generate-sources", "generate any source code for inclusion in compilation."),
		new Phase("process-sources", "process the source code, for example to filter any values."),
		new Phase("generate-resources", "generate resources for inclusion in the package."),
		new Phase("process-resources", "copy and process the resources into the destination directory, ready for packaging."),
		new Phase("compile", "compile the source code of the project."),
		new Phase("process-classes", "post-process the generated files from compilation, for example to do bytecode enhancement on Java classes."),
		new Phase("generate-test-sources", "generate any test source code for inclusion in compilation."),
		new Phase("process-test-sources", "process the test source code, for example to filter any values."),
		new Phase("generate-test-resources", "create resources for testing."),
		new Phase("process-test-resources", "copy and process the resources into the test destination directory."),
		new Phase("test-compile", "compile the test source code into the test destination directory"),
		new Phase("process-test-classes", "post-process the generated files from test compilation, for example to do bytecode enhancement on Java classes. For Maven 2.0.5 and above."),
		new Phase("test", "run tests using a suitable unit testing framework. These tests should not require the code be packaged or deployed."),
		new Phase("prepare-package", "perform any operations necessary to prepare a package before the actual packaging. This often results in an unpacked, processed version of the package. (Maven 2.1 and above)"),
		new Phase("package", "take the compiled code and package it in its distributable format, such as a JAR."),
		new Phase("pre-integration-test", "perform actions required before integration tests are executed. This may involve things such as setting up the required environment."),
		new Phase("integration-test", "process and deploy the package if necessary into an environment where integration tests can be run."),
		new Phase("post-integration-test", "perform actions required after integration tests have been executed. This may including cleaning up the environment."),
		new Phase("verify", "run any checks to verify the package is valid and meets quality criteria."),
		new Phase("install", "install the package into the local repository, for use as a dependency in other projects locally."),
		new Phase("deploy", "done in an integration or release environment, copies the final package to the remote repository for sharing with other developers and projects."),
		new Phase("pre-site", "execute processes needed prior to the actual project site generation"),
		new Phase("site", "generate the project's site documentation"),
		new Phase("post-site", "execute processes needed to finalize the site generation, and to prepare for site deployment"),
		new Phase("site-deploy", "deploy the generated site documentation to the specified web server"),
	};
}
